import Vue from 'vue'
import HelloWorld from '@/components/HelloWorld'
import mainIndex from '@/view/user/index.vue'
import userList from '@/view/user/userList.vue'
import addUser from '@/view/user/addUser.vue'
import insertPermission from '@/view/permission/insertPermission.vue'
import permission from '@/view/permission/permission.vue'
import insertRole from '@/view/role/addOrUpdateRole.vue'
import role from '@/view/role/roleList.vue'

import Router from 'vue-router'
const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      component: mainIndex
    },
    {
      path:'/toUserList',
      component:userList
    },
    {
      path:'/toAddUser/:id',
      component:addUser
    },
    {
      path:'/toAddUser',
      component:addUser
    },
    {
      path:'/toPermission',
      component:permission
    },
    {
      path:'/toInsertPermission',
      component:insertPermission
    },
    {
      path:'/toInsertPermission/:id',
      component:insertPermission
    },
    {
      path:'/toRoles',
      component:role
    },
    {
      path:'/toInsertRoles',
      component:insertRole
    },
    {
      path:'/toInsertRoles/:id',
      component:insertRole
    }
  ]
})
